package com.wetao.lib_common.utils;

import android.text.InputFilter;
import android.text.Spanned;
import android.widget.EditText;

/**
 * author: zhouyh
 * created on: 2020-05-13 11:17
 * description:
 */
public class InputUtils {


    public static void setEditTextInhibitInputSpace(EditText editText){
        InputFilter filter=new InputFilter() {
            @Override
            public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
                if(source.equals(" "))return "";
                else return null;
            }
        };
        editText.setFilters(new InputFilter[]{filter});
    }
}
